﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Rights.aspx.cs" Inherits="OneMG.Phoenix.AdminSite.Views.Passport.Rights" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">新闻管理
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadScripts" runat="server">
  <script type="text/javascript" src="/Scripts/m-former.js"></script>  
   <script type="text/javascript" src="/Scripts/m-lhgdialog/m-lhgdialog.js"></script>     
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
            <form id="form1" runat="server">

    <div class="path">
        <a href="/Views/Passport/Rights.aspx"><strong>权限管理</strong></a>
    </div>
    <div class="pd10">
        <div class="mb10 aL">
            <a href="javascript:;" title="新增" class="a-btn1" onclick="OpenPop('/Views/Passport/RightsEdit.aspx', '添加权限',500,350)">添加权限</a>
            <a href="/Views/Passport/Rights.aspx" title="权限分类" class="a-btn1" >权限分类</a>
             <span style="float:right;">按分类查看
              <select id="sltCategoryID" name="sltCategoryID">
                    <option value="0">所有</option>
                        <%foreach (OneMG.Phoenix.Service.Model.RightsTypeModel c in RightsTypeList)%>
                        <%{%>
                            <% if (RightTypeID == c.TypeID) %>
                            <%{%>
                                <option value="<%=c.TypeID %>" selected="selected"> <%=c.TypeName%></option>
                            <%}%>
                            <%else %>
                            <%{ %>
                                 <option value="<%=c.TypeID %>"><%=c.TypeName%></option>
                            <%} %>
                        <%}%>
                    </select>
            </span>
        </div>
        
        <span id="Grid">
<table class="tb-list hover">
    <tr>
        <th>
            编号
        </th>
        <th>
            权限名称
        </th>
        <th>
            权限代码
        </th>
        <th width="20%">
            操作
        </th>
    </tr>
   <% foreach (OneMG.Phoenix.Service.Model.RightsModel item in RightsList) %>
    <%{%>
    <tr>
        <td style="width:30%">
           <%=item.RightID %>
        </td>
         <td style="width:20%">
           <%=item.RightDisplayName%>
        </td>         
        <td style="width:30%">
           <%=item.RightName %>
        </td>
        <td style="width:20%">
            <a href="javascript:void(showEdit('<%=item.RightID %>'))">编辑</a> 
            <a href="javascript:;" onclick="DeleteRights('<%=item.RightID %>')">删除</a>
        </td>
    </tr>
<%}%>
</table>
        </span>
            <!-- 分页插件  -->
        <div id="pager" class="aR mt10">
            
        </div>

    </div>
    </form>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Scripts" runat="server">

<script type="text/javascript" src="/Scripts/library/m-pagination.js"></script>    
    <script type="text/javascript">
        
        // 删除类目
        function DeleteRights(rightID) {
            if (confirm("确认删除吗?") == false) {
                return;
            }
            $.ajax({
                url: "/Views/Passport/RightsSave.ashx",
                data: { "Action":2,"RightID": rightID },
                type: "POST",
                success: function(data, textStatus) {
                    if (data.status === "warning" || data.status === "error") {
                        alert(data.msg);
                        return false;
                    }
                    // 刷新列表
                    //refresh();
                },
                error: function(XmlHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });
        };

        // 显示编辑
        function showEdit(rid) {
            OpenPop('/Views/Passport/RightsEdit.aspx?rid=' + rid , "编辑权限", 500, 350);
        };
        
        //打开弹窗
        function OpenPop(url, titleName, width, height) {
            width = width || 800;
            height = height || 500;
            window.top.winObj = window;
            window.top.oDG = new $.dialog({ id: 'esDialog', title: titleName, page: url, width: width, height: height, btnBar: false, lockScroll: true });
            window.top.oDG.ShowDialog();
        }
        
</script> 
</asp:Content>
